﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web.Text
{
    public partial class cregex : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string type = "B";
            switch (type)
            {
                case "A":
                    A();
                    break;
                case "B":
                    B();
                    break;
                case "C":
                    C();
                    break;
                case "D":
                    D();
                    break;
                default: break;
            }
        }
        //Replace(string input, string pattern, string replacement)
        private void A()
        {
            string html = "$(readRank).rem03/09/2014oveClass('fixedReadRank');";
            string b = MSL.Utility.Text.CRegex.Replace(html, @"(?<month>\d{1,2})/(?<day>\d{1,2})/(?<year>\d{2,4})", "${year}-${month}-{day}$");
            string c = MSL.Utility.Text.CRegex.Replace(html, @"(?<month>\d{1,2})/(?<day>\d{1,2})/(?<year>\d{2,4})", "{year$}-{month$}-{$day}");
            string d = MSL.Utility.Text.CRegex.Replace(html, @"(?<month>\d{1,2})/(?<day>\d{1,2})/(?<year>\d{2,4})", "$3-$1-$2");

            html = "blogRank = $('.catListBlogRank');>02要闻<>03头版<";
            string e = MSL.Utility.Text.CRegex.Replace(html, @">(\d+)([\u4e00-\u9fa5]+<)", ">$1版：$2");
        }
        //ReadFile
        private void B()
        {
            string a = MSL.Utility.Text.CString.ReadFile("c:\\1.txt");
            string b = MSL.Utility.Text.CString.ReadFile("c:\\2.txt");
        }
        //GetFiles
        private void C()
        {
        }
        private void D()
        {

        }
        private void E()
        {

        }
    }
}